﻿

package Memoir 
{
	import flash.display.Bitmap;
	import flash.geom.Point;
	
	import org.flixel.*;

	/**
	 * Handles cursor display.
	 */
	
		
	public class Player extends FlxSprite
	{
		[Embed(source = '../Assets/CameraShutter.png')] private var CursorImg:Class;
		//public var regMouse:Boolean = false; // if true, mouse keeps pointer-style cursor no matter where it is on screen
		

		public function Player():void 
		{



			//super(X,Y);
			loadGraphic(CursorImg, true, false, 90, 90, true);
			
			width = 90;
			height = 90;
			
			addAnimation("snap", [0, 1, 2, 3,4,4,3,2,1,0], 30, false);
			addAnimation("normal", [0], 0, false);
			addAnimation("standin", [5],0,false);
			
			
		}
		
		override public function update():void {
			//play("normal");			
			super.updateAnimation();
			// Player (cursor) behavior depends on where the cursor is on the screen.
			updateMotion();
		} 
		
		/**
		 * Less fancy than default version. 
		 */
		protected override function updateMotion():void
		{
			if (FlxG.mouse.y>499){
				play("standin");
				x = FlxG.mouse.x;
				y = FlxG.mouse.y;
			}
			else{
				x=Math.min(FlxG.mouse.x,709);
				y=Math.min(FlxG.mouse.y,409);
			}
		}
		
		public function getMiddlePoint():Point {
			return new Point(FlxG.mouse.x+width/2,FlxG.mouse.y+height/2);
		}
		

		
	}
}